package com.damai.utils;

import java.io.IOException;

import com.citywithincity.api.post.ApiPost;
import com.citywithincity.api.post.ApiPostFactory;
import com.citywithincity.api.post.impl.BsApiPost;
import com.citywithincity.utils.MD5Util;
import com.damai.annotation.Crypt;

public class HotBuilderUtils {
	
	
	
	public  static void ecard(String baseUrl,String url) throws IOException{
		ApiPostFactory factory = new ApiPostFactory(baseUrl);
		ApiPost post = factory.createDefault("18659210057", MD5Util.md5Appkey("123456"));
		post.post("structs/hot", Arguments.newMap().put("url", url).get(), Crypt.BOTH);
	}
	
	/**
	 * 
	 * @param baseUrl
	 * @param url
	 * @throws IOException
	 */
	public static void business(boolean isTest,String url) throws IOException {
		String baseUrl;
		if(isTest) {
			baseUrl = "http://110.80.22.108:28080/business/";
		}else {
			baseUrl = "http://218.5.80.17:28049/business/";
		}
		
		ApiPostFactory factory = new ApiPostFactory(baseUrl);
		BsApiPost post = (BsApiPost)factory.createBs("15859218407", MD5Util.md5Appkey("123456"));
		post.requestToken();
		post.post("structs/hot", Arguments.newMap().put("url", url).get(), Crypt.BOTH);
	}

}
